//app.js
//wxaa5a075c621b5cae
App({
  globalData: {
    appId: 'wxaa5a075c621b5cae',
    appSecret: 'a011a45d060892e33cdaad79defa3d31',
    code: null,
    userInfo: null
  },
  onLaunch() {
    let that = this;
    wx.login({
      success(res) {
        if (res.code) {
          // 发起网络请求
          // wx.request({
          //   url: 'https://api.weixin.qq.com/sns/jscode2session?appid=appId&secret=appSecret&js_code=code&grant_type=authorization_code',
          //   data: {
          //     appId: that.globalData.appId,
          //     appSecret: that.globalData.appSecret,
          //     code: res.code
          //   },
          //   success: function(res) {
          //     console.log(res.data)
          //   }
          // })
        } else {
          console.log('登录失败！' + res.errMsg)
        }
      }
    })
  }
})